﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace BuildHelper.Work.Tools.Security
{
    public partial class FormNewSecurity : XtraForm
    {
        public FormNewSecurity()
        {
            InitializeComponent();
        }

        private void buttonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            var b = browserProvider1.GetBrowser(Init.InitFormBrowserNames.Setup.Brancze);
            var dlg = b.ShowMultiSelectDialog(buttonEdit1.EditValue);
            if (dlg.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                buttonEdit1.EditValue = dlg.Value;
            }
        }

        private void buttonEdit1_CustomDisplayText(object sender, DevExpress.XtraEditors.Controls.CustomDisplayTextEventArgs e)
        {
            e.DisplayText = string.Empty;
            if (e.Value is object[])
            {
                e.DisplayText = ((object[])e.Value).AsString(", ");
            }
        }

    }
}
